package com.outstanding.junit.enums;

import com.outstanding.framework.core.BaseEnum;

public enum MessageType implements BaseEnum<MessageType,String> {

	SMS("1", "短信"),
    VOICE("2","语音"),
    MESSAGE("3","消息");
	
	private String code;
	
	private String name;
	
	private MessageType(String code, String name){
        this.code = code;
        this.name = name;
    }
	
	/**
	 * 根据code获取对应枚举
	 * @param code
	 * @return
	 */
	public static MessageType getByCode(String code) {
		MessageType[] array = MessageType.values();
		for (MessageType bd : array) {
			if (bd.getCode().equals(code)) {
				return bd;
			}
		}
		return null;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
